package com.ea.admin.service;

import com.ea.admin.pojo.vo.file.FileInfoVo;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.util.List;

public interface FileService {
    // 500K
    Integer CHUNK_SIZE = 1024 * 500;

    String getPathByType(String type);

    void uploadFile(MultipartFile file, String md5, String type);

    void downloadFile(HttpServletResponse response, String md5);

    void uploadChunk(MultipartFile chunk, Integer index, Integer totalChunks, String md5, String type);

    void downloadChunk(HttpServletResponse response, Integer index, String md5, Integer chunkSize);

    void merge(String md5, String type);

    List<Integer> getUploadedList(String md5);

    List<Integer> getUploadedList(String md5, String type);

    File getFileByMd5(String excelMd5);

    FileInfoVo getFileInfo(String md5);

    String unZipByMd5(String zipMd5);

    String getTempPathByType(String type);

    void saveTempFile(File tempFile, String tempFileMd5, String type);

    void deleteFileByMd5(String md5);

    String saveWebmFileFromBytes(byte[] file, String fileUUID, Integer index);

    MultipartFile convertFileToMultipartFile(File file);

    void updateMysqlFile(String filePath, String type, String fileUUID);

    String savePhotoFileFromBytes(byte[] file, String fileUUID, Integer index);
}
